import { init, h } from 'snabbdom'
import { styleModule } from 'snabbdom/modules/style'
import { eventListenersModule } from 'snabbdom/modules/eventlisteners'

let patch = init([styleModule, eventListenersModule])
let vnode = h('div#contianer', {
  style: {
    backgroundColor: 'red'
  },
  on: {
    click: eventHandler
  }
}, [
  h('h1', 'Hello Snabbdom'),
  h('p', '这是一个 p 标签')
])

function eventHandler () {
  console.log('click')
}

let app = document.querySelector('#app')
let oldVnode = patch(app, vnode)
